<?php 

global $_GPC, $_W;

$GLOBALS['frames'] = $this->getMainMenu();

$info = pdo_get('snx_prize',array('id'=>$_GPC['id']));

if (checksubmit('submit')) {
	$data['name'] = $_GPC['name'];
	$data['pic'] = $_GPC['pic'];
    $data['num'] = $_GPC['num'];
    if (empty($_GPC['num'])) {
        message('数量不能为0','','error');
		}
    $data['need_score'] = $_GPC['need_score'];
	$data['description'] = html_entity_decode($_GPC['description']);
	$data['create_time'] = date('Y-m-d H:i:s',time());
    $data['uniacid']=$_W['uniacid'];
	if($_GPC['id']==''){  
        $rst=pdo_insert('snx_prize',$data);      
        if($rst){
             message('添加成功！', $this->createWebUrl('prize'), 'success');
        }else{
             message('添加失败！','','error');
        }

    }else{
         $rst=pdo_update('snx_prize',$data,array('id'=>$_GPC['id']));
        if($rst){
             message('编辑成功！', $this->createWebUrl('prize'), 'success');
        }else{

             message('编辑失败！','','error');

        }

    }

}

include $this->template('web/addprize');

 ?>